package com.megvii.koala.net.visitor;

import com.megvii.corelib.net.RequestParam;
import com.megvii.corelib.net.request.MegviiRequest;
import com.megvii.corelib.util.DateTimeUtil;
import com.megvii.koala.data.bean.VisitorBean;
import com.megvii.koala.net.Commands;

/**
 * Created by linyue on 15/12/28.
 */
public class EditVisitorRequest implements MegviiRequest
{
    public String visitorId;

    @RequestParam
    public int visit_notify;

    @RequestParam
    public int subject_type;

    @RequestParam
    public long start_time;

    @RequestParam
    public long end_time;

    @RequestParam
    public int purpose;

    @RequestParam
    public String remark;

    @RequestParam
    public String description;

    @RequestParam
    public String phone;

    @RequestParam
    public String department;

    public EditVisitorRequest()
    {
        super();
    }

    public EditVisitorRequest(VisitorBean visitor)
    {
        super();
        visitorId = visitor.id;
        visit_notify = visitor.visit_notify ? 1 : 0;
        subject_type = visitor.subject_type;
        start_time = DateTimeUtil.toSTimestamp(visitor.start_time);
        end_time = DateTimeUtil.toSTimestamp(visitor.end_time);
        purpose = visitor.purpose;
        remark = visitor.remark;
        description = visitor.description;
        phone = visitor.phone;
        department = visitor.department;
    }

    @Override
    public String getCommand()
    {
        return Commands.EDIT_VISITOR_INFO + "/" + visitorId;
    }
}
